package controllers

import (
	beego "github.com/beego/beego/v2/server/web"
	"novels/commit"
)

type UserController struct {
	beego.Controller
}

func (c *UserController) Login() {
	username := c.GetString("username")
	password := c.GetString("password")
	if username == "" || password == "" {
		c.Data["json"] = map[string]interface{}{
			"code": 0,
			"msg":  "用户名不存在或者密码错误",
		}
	}
	if password != commit.Md5(password) {
		c.Data["json"] = map[string]interface{}{
			"code": 0,
			"msg":  "密码错误",
		}
	}
}
